
{*include file='share/head.html'*}


{*include file='admin/header.html'*}
	<!--内容-->
	<div class="IC-card">
		<div class="container">
			<!--查看车辆信息-->
			<div class="IC-content" >
				<h2>车辆信息状态</h2>
				<div id="state">
					<div class="state-item"> <strong>车身颜色</strong>
						<ol>
							{*foreach $carconf.vehicleBodyColor as $value*}
							{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleBodyColor" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>车辆等级</strong>
						<ol>
							{*foreach $carconf.vehicleGrade as $value*}
							{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleGrade" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>车辆牌号</strong>
						<ol>
							{*foreach $carconf.vehicleCodePrefix as $value*}
							{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleCodePrefix" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>车辆类型</strong>
						<ol>
							{*foreach $carconf.vehicleType as $value*}
							{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleType" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>尾气排放标准</strong>
						<ol>
							{*foreach $carconf.vehicleDischarge as $value*}
							{*if $value!=''*}{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleDischarge" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>汽油类别</strong>
						<ol>
							{*foreach $carconf.vehicleOilType as $value*}
							{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleOilType" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>车牌颜色</strong>
						<ol>
							{*foreach $carconf.vehicleCardColor as $value*}
							{*if $value!=''*}{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleCardColor" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>技术等级</strong>
						<ol>
							{*foreach $carconf.vehicleDegreeType as $value*}
							{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleDegreeType" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>车辆类别</strong>
						<ol>
							{*foreach $carconf.vehicleProperty as $value*}
							{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleProperty" value="请输入添加元素">
					</div>
					<div class="state-item"><strong>生产厂家</strong>
						<ol>
							{*foreach $carconf.vehicleManufacturer as $value*}
							{*if $value!=''*}<li><span></span><p class="p">{*$value*}</p></li>{*/if*}
							{*/foreach*}
						</ol>
						<input type="text" class="form-control di" name="vehicleManufacturer" value="请输入添加元素">
					</div>
				</div>
				<!--查看车辆信息结束-->
			</div>
			<script src="static/pubilc/bootstrap/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
			<script type="text/javascript">
			    $(function () {
			        $("#state").delegate('ol li', {
			            mouseenter: function () {
			                $(this).find('span').css('display', 'block');
			            },
			            mouseleave: function () {
			                $(this).find('span').css('display', 'none');
			            },
			        }).delegate('ol li p', {    
			            click: function () {
			               $(this).parents('#state').find('p')
			               		.attr('contentEditable', false)
			                    .css({
			                        'border': '1px solid #ccc',
			                        'box-shadow': 'initial'
			                    });
			               $(this).attr('contentEditable', true)
			                        .css({
			                            'border': '1px solid #428bca',
			                            'box-shadow': '0 0 4px #428bca'
			                        });
			
			                $(this).parents('body').data({
			                    'obj': $(this),
			                    'oldValue': $(this).text()
			                });
			                return false;
			            }
			        }).delegate('input.di', {
			            focus: function () {
			                $(this).val('');
			            },
			            blur: function () {
			                $(this).val('请输入添加元素');
			            },
			            change: function () {//添加
			                if ($(this).val() === '') return;
			                var confName = $(this).attr('name');
			                var value = $(this).val();
			                var str = '<li><span></span><p class="p">' + $(this).val() + '</p></li> ';
			                var length = $(this).parents('.state-item').find('li').length;
			                value = length == 0?value:','+value;
			                
			                $.get('admin.php?c=admin&m=setconfig&confName='+confName+'&value='+value,
							function(data,status){
//							    alert("数据: " + data + "\n状态: " + status);
							});
			                
			                $(this).siblings('ol').append($(str));
			            }
			        }).delegate('ol span', {//删除
			            click: function () {
			                var value = $(this).siblings('p').text();
			                var confName = $(this).parents('ol').siblings('input').attr('name');
			                var lastvalue = $(this).parents('ol').find("li:last p").text();
			                var length = $(this).parents('ol').find("li").length;
							value = length == 1?value:(value != lastvalue? value+',':','+value);
							
			                $.get('admin.php?c=admin&m=delconf&confName='+confName+'&value='+value,
							function(data,status){
							   // alert("数据: " + data + "\n状态: " + status);
							});
			                $(this).parent().remove();
							return false;
			            }
			        });
			
			
			        $('.IC-content').click(function () {//修改
			            var obj = $(this).parents('body').data('obj');
			            if (obj == undefined) return false;
			            
			            var oldValue = $(this).parents('body').data('oldValue');
			            var value = obj.text();
			            var confName = obj.parents('ol').siblings('input').attr("name");
			            obj.attr('contentEditable', false)
		                    .css({
		                        'border': '1px solid #ccc',
		                        'box-shadow': 'initial'
		                    });
			            if (value == '' || value == oldValue){
			            	obj.text(oldValue);
			            	return false;
			            }
			            
			            
						$.get('admin.php?c=admin&m=setconfig&confName='+confName
								+'&oldvalue='+oldValue+'&value='+value,
						function(data,status){
						    alert("数据: " + data + "\n状态: " + status);
						});
						
			            $(this).find('body').removeData('obj oldValue');
			        }).keydown(function(event){ 
			          if (event.ctrlKey || event.keyCode === 13){ 
			            $(this).click()
			            return false;
			          } 
			        });
			    });
			</script>
		</div>	
	</div>
{*include file='share/footer.html'*}